
<!DOCTYPE HTML>
<html lang="zh" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>交易时段和时间信息 · Pine Script 用户手册中文版</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="剑客">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="11strategies.html" />
    
    
    <link rel="prev" href="9nonstandard.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="輸入並搜尋" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../Introduction.html">
            
                <a href="../Introduction.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../quickstart/">
            
                <a href="../quickstart/">
            
                    
                    快速开始
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../quickstart/example.html">
            
                <a href="../quickstart/example.html">
            
                    
                    Pine Script 示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../quickstart/studyVsStrategy.html">
            
                <a href="../quickstart/studyVsStrategy.html">
            
                    
                    “study” 与 “strategy”
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../quickstart/model.html">
            
                <a href="../quickstart/model.html">
            
                    
                    Pine Script 执行模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../quickstart/series.html">
            
                <a href="../quickstart/series.html">
            
                    
                    序列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../quickstart/understanding.html">
            
                <a href="../quickstart/understanding.html">
            
                    
                    理解 Pine Script
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../quickstart/editor.html">
            
                <a href="../quickstart/editor.html">
            
                    
                    Pine 编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../quickstart/next.html">
            
                <a href="../quickstart/next.html">
            
                    
                    下一步
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../fundamentals/">
            
                <a href="../fundamentals/">
            
                    
                    语言基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../fundamentals/1structure.html">
            
                <a href="../fundamentals/1structure.html">
            
                    
                    脚本结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../fundamentals/2version.html">
            
                <a href="../fundamentals/2version.html">
            
                    
                    版本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../fundamentals/3comment.html">
            
                <a href="../fundamentals/3comment.html">
            
                    
                    注释
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../fundamentals/4identifier.html">
            
                <a href="../fundamentals/4identifier.html">
            
                    
                    标识符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../fundamentals/5line.html">
            
                <a href="../fundamentals/5line.html">
            
                    
                    换行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../fundamentals/6type.html">
            
                <a href="../fundamentals/6type.html">
            
                    
                    类型系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../fundamentals/7operator.html">
            
                <a href="../fundamentals/7operator.html">
            
                    
                    运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../fundamentals/8function.html">
            
                <a href="../fundamentals/8function.html">
            
                    
                    函数和注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../fundamentals/9expressions.html">
            
                <a href="../fundamentals/9expressions.html">
            
                    
                    表达式、声明和语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../fundamentals/10function.html">
            
                <a href="../fundamentals/10function.html">
            
                    
                    函数声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="../fundamentals/11model.html">
            
                <a href="../fundamentals/11model.html">
            
                    
                    执行模型
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="./">
            
                <a href="./">
            
                    
                    基本功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="1alert.html">
            
                <a href="1alert.html">
            
                    
                    警报
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="2array.html">
            
                <a href="2array.html">
            
                    
                    数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="3barstate.html">
            
                <a href="3barstate.html">
            
                    
                    柱状态，内置变量 barstate.*
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="4color.html">
            
                <a href="4color.html">
            
                    
                    颜色
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="5context.html">
            
                <a href="5context.html">
            
                    
                    上下文切换和 security 函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="6drawing.html">
            
                <a href="6drawing.html">
            
                    
                    绘图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="7extend.html">
            
                <a href="7extend.html">
            
                    
                    延长和扩展交易数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="8reapint.html">
            
                <a href="8reapint.html">
            
                    
                    指标重绘
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="9nonstandard.html">
            
                <a href="9nonstandard.html">
            
                    
                    非标准图表类型数据
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.10" data-path="10session.html">
            
                <a href="10session.html">
            
                    
                    交易时段和时间信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.11" data-path="11strategies.html">
            
                <a href="11strategies.html">
            
                    
                    策略
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.12" data-path="12table.html">
            
                <a href="12table.html">
            
                    
                    图表
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../annotations/">
            
                <a href="../annotations/">
            
                    
                    注解概览
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../annotations/1study.html">
            
                <a href="../annotations/1study.html">
            
                    
                    指标注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../annotations/2plot.html">
            
                <a href="../annotations/2plot.html">
            
                    
                    绘图注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../annotations/3input.html">
            
                <a href="../annotations/3input.html">
            
                    
                    脚本输入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../annotations/4price.html">
            
                <a href="../annotations/4price.html">
            
                    
                    价格水平，hline
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../annotations/5fill.html">
            
                <a href="../annotations/5fill.html">
            
                    
                    用 fill 填充背景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../annotations/6barcolor.html">
            
                <a href="../annotations/6barcolor.html">
            
                    
                    使用 barcolor 为 series 着色
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../annotations/7bg.html">
            
                <a href="../annotations/7bg.html">
            
                    
                    使用 bgcolor 进行背景着色
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../annotations/8shape.html">
            
                <a href="../annotations/8shape.html">
            
                    
                    绘制形状、字符和箭头
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../annotations/9custom.html">
            
                <a href="../annotations/9custom.html">
            
                    
                    定制 OHLC 柱和蜡烛
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../debugging/">
            
                <a href="../debugging/">
            
                    
                    调试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../debugging/1introduction.html">
            
                <a href="../debugging/1introduction.html">
            
                    
                    指标注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../debugging/2land.html">
            
                <a href="../debugging/2land.html">
            
                    
                    功能位置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../debugging/3num.html">
            
                <a href="../debugging/3num.html">
            
                    
                    显示数值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../debugging/4str.html">
            
                <a href="../debugging/4str.html">
            
                    
                    显示字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../debugging/5conditions.html">
            
                <a href="../debugging/5conditions.html">
            
                    
                    调试条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../debugging/6fn.html">
            
                <a href="../debugging/6fn.html">
            
                    
                    从内部函数调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../debugging/7for.html">
            
                <a href="../debugging/7for.html">
            
                    
                    从“for”循环内部调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../debugging/8tips.html">
            
                <a href="../debugging/8tips.html">
            
                    
                    提示
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../publishing/">
            
                <a href="../publishing/">
            
                    
                    发布脚本
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../publishing/1pvp.html">
            
                <a href="../publishing/1pvp.html">
            
                    
                    公共脚本与私有脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../publishing/2mode.html">
            
                <a href="../publishing/2mode.html">
            
                    
                    发布模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../publishing/3ps.html">
            
                <a href="../publishing/3ps.html">
            
                    
                    如何发布脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../publishing/4us.html">
            
                <a href="../publishing/4us.html">
            
                    
                    如何更新脚本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../library/">
            
                <a href="../library/">
            
                    
                    公共库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../library/1description.html">
            
                <a href="../library/1description.html">
            
                    
                    描述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../library/2copy.html">
            
                <a href="../library/2copy.html">
            
                    
                    将脚本从公共库复制到您的个人库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../library/3editing.html">
            
                <a href="../library/3editing.html">
            
                    
                    编辑来自公共库的脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../library/4searching.html">
            
                <a href="../library/4searching.html">
            
                    
                    搜索脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../library/5video.html">
            
                <a href="../library/5video.html">
            
                    
                    教学视频
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../appendix/">
            
                <a href="../appendix/">
            
                    
                    附录
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../appendix/1migration.html">
            
                <a href="../appendix/1migration.html">
            
                    
                    Pine 第 3 版迁移指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../appendix/2how.html">
            
                <a href="../appendix/2how.html">
            
                    
                    操作指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../appendix/3err.html">
            
                <a href="../appendix/3err.html">
            
                    
                    Pine 的编译和执行错误
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../more/">
            
                <a href="../more/">
            
                    
                    我可以从哪里获得更多信息？
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本書使用 GitBook 釋出
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >交易时段和时间信息</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x548C;&#x65F6;&#x95F4;&#x4FE1;&#x606F;">&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x548C;&#x65F6;&#x95F4;&#x4FE1;&#x606F;</h1>
<hr>
<h2 id="time&#x51FD;&#x6570;&#x548C;&#x53D8;&#x91CF;">&#x201C;time&#x201D;&#x51FD;&#x6570;&#x548C;&#x53D8;&#x91CF;</h2>
<p>Pine &#x63D0;&#x4F9B;&#x4E86;&#x5904;&#x7406;&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x3001;&#x65F6;&#x95F4;&#x548C;&#x65E5;&#x671F;&#x4FE1;&#x606F;&#x7684;&#x624B;&#x6BB5;&#x3002;&#x5728;&#x8FD9;&#x4E2A; 30 &#x5206;&#x949F;&#x7684; IBM &#x56FE;&#x8868;&#x4E0A;&#xFF0C;&#x6709;&#x4E24;&#x4E2A;&#x811A;&#x672C;&#x6B63;&#x5728;&#x8FD0;&#x884C;&#x3002;&quot;Bar date/time&quot;&#x548C;&quot;Session bars&quot;&#x3002;</p>
<p><img src="../img/310sn/Chart_time_1.png" alt="&#x793A;&#x4F8B;&#x56FE;"></p>
<p>&#x8FD9;&#x662F;&#x201C;Bar date/time&#x201D;&#x811A;&#x672C;&#xFF1A;</p>
<pre><code>//@version=4
study(&quot;Bar date/time&quot;)
plot(time)
</code></pre><p>&#x65F6;&#x95F4;&#x53D8;&#x91CF;&#x4EE5; UNIX &#x683C;&#x5F0F;[1]&#x548C;&#x4EA4;&#x6613;&#x6240;&#x7684;&#x65F6;&#x533A;&#x8FD4;&#x56DE;&#x6BCF;&#x4E2A;&#x67F1;&#x56FE;&#x5F00;&#x76D8;&#x65F6;&#x95F4;&#x7684;&#x65E5;&#x671F;/&#x65F6;&#x95F4;&#xFF08;&#x65F6;&#x95F4;&#x6233;&#xFF09;&#x3002;&#x4ECE;&#x622A;&#x56FE;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF0C;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x67F1;&#x56FE;&#x7684;&#x65F6;&#x95F4;&#x503C;&#x7B49;&#x4E8E; 1397593800000&#x3002;&#x8FD9;&#x4E2A;&#x503C;&#x662F;&#x81EA; 1970 &#x5E74; 1 &#x6708; 1 &#x65E5; 00:00:00 UTC &#x4EE5;&#x6765;&#x7ECF;&#x8FC7;&#x7684;&#x6BEB;&#x79D2;&#x6570;&#xFF0C;&#x5BF9;&#x5E94;&#x4E8E; 2014 &#x5E74; 4 &#x6708; 15 &#x65E5;&#x661F;&#x671F;&#x4E8C; 20:30:00 UTC&#x3002;&#x622A;&#x56FE;&#x4E2D;&#x7684;&#x56FE;&#x8868;&#x65F6;&#x95F4;&#x8868;&#x663E;&#x793A;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x67F1;&#x56FE;&#x7684;&#x65F6;&#x95F4;&#x4E3A; 2014-04-15 16:30&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x4E0E;&#x4EA4;&#x6613;&#x6240;&#x7684;&#x65F6;&#x533A;&#x6709; 4 &#x5C0F;&#x65F6;&#x7684;&#x5DEE;&#x5F02;&#xFF0C;&#x8FD9;&#x662F;&#x65F6;&#x95F4;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x9ED8;&#x8BA4;&#x65F6;&#x95F4;&#x3002;</p>
<p>&#x7B2C;&#x4E8C;&#x4E2A;&#x811A;&#x672C;&#x662F;&quot;Session bars&quot;&#xFF1A;</p>
<pre><code>//@version=4
study(&quot;Session bars&quot;)
t = time(timeframe.period, &quot;0930-1600&quot;)
plot(na(t) ? 0 : 1)
</code></pre><p>&#x8FD9;&#x663E;&#x793A;&#x4E86;&#x7528;&#x6237;&#x5982;&#x4F55;&#x901A;&#x8FC7;&#x4F7F;&#x7528;&#x5185;&#x7F6E;&#x7684;&#x65F6;&#x95F4;&#x51FD;&#x6570;&#x800C;&#x4E0D;&#x662F;&#x65F6;&#x95F4;&#x53D8;&#x91CF;&#x6765;&#x533A;&#x5206;&#x5E38;&#x89C4;&#x65F6;&#x6BB5;&#x548C;&#x5EF6;&#x957F;&#x65F6;&#x95F4;&#x3002;&#x8BF7;&#x6CE8;&#x610F;&#xFF0C;&#x8FD9;&#x4E9B;&#x67F1;&#x56FE;&#x540E;&#x9762;&#x7684;&#x80CC;&#x666F;&#x662F;&#x5F69;&#x8272;&#x7684;&#xFF0C;&#x8FD9;&#x662F;&#x56E0;&#x4E3A;&#x56FE;&#x8868;&#x7684;&#x8BBE;&#x7F6E;&#xFF1B;&#x800C;&#x4E0D;&#x662F;&#x56E0;&#x4E3A;&#x811A;&#x672C;&#x7684;&#x539F;&#x56E0;&#x3002;&#x65F6;&#x95F4;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x67F1;&#x56FE;&#x5F00;&#x59CB;&#x7684;&#x65F6;&#x95F4;&#xFF0C;&#x5355;&#x4F4D;&#x662F;UNIX&#x65F6;&#x95F4;&#x7684;&#x6BEB;&#x79D2;&#xFF0C;&#x5982;&#x679C;&#x67F1;&#x56FE;&#x4F4D;&#x4E8E;&#x7ED9;&#x5B9A;&#x7684;&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x4E4B;&#x5916;&#xFF08;&#x5728;&#x6211;&#x4EEC;&#x7684;&#x4F8B;&#x5B50;&#x4E2D;&#x662F; 09:30 - 16:00&#xFF09;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; na&#x3002;&#x65F6;&#x95F4;&#x51FD;&#x6570;&#x63A5;&#x53D7;&#x4E24;&#x4E2A;&#x53C2;&#x6570;&#xFF1A;&#x7528;&#x4E8E;&#x786E;&#x5B9A;&#x67F1;&#x56FE;&#x548C;&#x4EA4;&#x6613;&#x65F6;&#x95F4;&#x7684;&#x65F6;&#x95F4;&#x6233;&#x7684;&#x65F6;&#x95F4;&#x7EA7;&#x522B;&#xFF0C;&#x4EA4;&#x6613;&#x65F6;&#x95F4;&#x89C4;&#x683C;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x5F62;&#x5F0F;&#xFF0C;&#x5305;&#x542B;&#x4EA4;&#x6613;&#x6240;&#x65F6;&#x533A;&#x7684;&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x7684;&#x5F00;&#x59CB;&#x548C;&#x7ED3;&#x675F;&#x3002;&#x5B57;&#x7B26;&#x4E32;&quot;0930 - 1600&quot;&#x5BF9;&#x5E94;&#x7684;&#x662F; IBM &#x7B26;&#x53F7;&#x7684;&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x3002;&#x8FD9;&#x4E9B;&#x662F;&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x89C4;&#x683C;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;</p>
<ul>
<li>0000-0000   <ul>
<li>&#x5468;&#x4E00;&#x81F3;&#x5468;&#x4E94;&#x7684; 24 &#x5C0F;&#x65F6;&#x4EA4;&#x6613;&#xFF0C;&#x4ECE;&#x5348;&#x591C;&#x5F00;&#x59CB;&#x3002;</li>
</ul>
</li>
<li>0900-1600, 1700-2000 <ul>
<li>&#x4E00;&#x4E2A;&#x4EA4;&#x6613;&#x65F6;&#x95F4;&#x4ECE; 9:00 &#x5F00;&#x59CB;&#xFF0C;&#x4ECE; 16:00 &#x5230; 17:00 &#x4E2D;&#x65AD;&#xFF0C;&#x4E00;&#x76F4;&#x6301;&#x7EED;&#x5230; 20:00&#x3002;&#x9002;&#x7528;&#x4E8E;&#x5468;&#x4E00;&#x81F3;&#x5468;&#x4E94;&#x3002;</li>
</ul>
</li>
<li>2000-1630:1234567<ul>
<li>&#x4ECE; 20:00 &#x5F00;&#x59CB;&#x5230;&#x7B2C;&#x4E8C;&#x5929; 16:30 &#x7ED3;&#x675F;&#x7684;&#x901A;&#x5BB5;&#x4EA4;&#x6613;&#x3002;</li>
</ul>
</li>
<li>0930-1700:146<ul>
<li>&#x5728;&#x661F;&#x671F;&#x65E5; (1)&#x3001;&#x661F;&#x671F;&#x4E09; (4) &#x548C;&#x661F;&#x671F;&#x4E94; (6) 9:30 &#x5F00;&#x59CB;&#x5230; 17:00 &#x7ED3;&#x675F;&#x7684;&#x4EA4;&#x6613;&#x65F6;&#x95F4;&#xFF08;&#x4E00;&#x5468;&#x4E2D;&#x7684;&#x5176;&#x4ED6;&#x65E5;&#x5B50;&#x662F;&#x4F11;&#x606F;&#x65E5;&#xFF09;&#x3002;</li>
</ul>
</li>
<li>24x7<ul>
<li>&#x6BCF;&#x5929; 00:00 &#x5F00;&#x59CB;&#x7684;&#x5B8C;&#x6574; 24 &#x5C0F;&#x65F6;&#x4EA4;&#x6613;&#x65F6;&#x95F4;&#x3002;</li>
</ul>
</li>
<li>0000-0000:1234567<ul>
<li>&#x4E0E;&#x201C;24x7&#x201D;&#x76F8;&#x540C;&#x3002;</li>
</ul>
</li>
<li>0000-0000:23456<ul>
<li>&#x4E0E;&#x524D;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x76F8;&#x540C;&#xFF0C;&#x4F46;&#x4EC5;&#x9650;&#x5468;&#x4E00;&#x81F3;&#x5468;&#x4E94;&#x3002;</li>
</ul>
</li>
<li>1700-1700:23456<ul>
<li>&#x4E00;&#x4E2A;&#x901A;&#x5BB5;&#x4EA4;&#x6613;&#x65F6;&#x95F4;&#x3002;&#x5468;&#x4E00;&#x65F6;&#x6BB5;&#x4ECE;&#x5468;&#x65E5; 17:00 &#x5F00;&#x59CB;&#xFF0C;&#x5230;&#x5468;&#x4E00; 17:00 &#x7ED3;&#x675F;&#x3002;&#x9002;&#x7528;&#x4E8E;&#x5468;&#x4E00;&#x81F3;&#x5468;&#x4E94;&#x3002;&#x76F8;&#x5F53;&#x4E8E;1700-1700</li>
</ul>
</li>
<li>1000-1001:26<ul>
<li>&#x4E00;&#x4E2A;&#x5947;&#x602A;&#x7684;&#x4EA4;&#x6613;&#x65F6;&#x95F4;&#xFF0C;&#x661F;&#x671F;&#x4E00;&#xFF08;2&#xFF09;&#x53EA;&#x6301;&#x7EED;&#x4E00;&#x5206;&#x949F;&#xFF0C;&#x661F;&#x671F;&#x4E94;&#xFF08;6&#xFF09;&#x53EA;&#x6301;&#x7EED;&#x4E00;&#x5206;&#x949F;&#x3002;</li>
</ul>
</li>
</ul>
<p>&#x7528;&#x4E8E; time &#x51FD;&#x6570;&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x7684;&#x65F6;&#x6BB5;&#x89C4;&#x8303;&#x4E0D;&#x9700;&#x8981;&#x4E0E;&#x4EA4;&#x6613;&#x5BF9;&#x7684;&#x771F;&#x5B9E;&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x76F8;&#x5BF9;&#x5E94;&#x3002;&#x5047;&#x8BBE;&#x7684;&#x4EA4;&#x6613;&#x65F6;&#x95F4;&#x6BB5;&#x89C4;&#x683C;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x7A81;&#x51FA;&#x6570;&#x636E; series &#x7684;&#x5176;&#x4ED6;&#x67F1;&#x3002;</p>
<p>Pine &#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A; time &#x51FD;&#x6570;&#x7684;&#x91CD;&#x8F7D;&#x7248;&#x672C;&#xFF0C;&#x5B83;&#x4E0D;&#x9700;&#x8981;&#x81EA;&#x5B9A;&#x4E49;&#x4EA4;&#x6613;&#x65F6;&#x6BB5;&#x3002;&#x8FD9;&#x4E2A;&#x7248;&#x672C;&#x7684;&#x51FD;&#x6570;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x4EA4;&#x6613;&#x5BF9;&#x7684;&#x5E38;&#x89C4;&#x65F6;&#x6BB5;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x7A81;&#x51FA;&#x663E;&#x793A;&#x5206;&#x949F;&#x56FE;&#x4E0A;&#x6BCF;&#x4E2A;&#x534A;&#x5C0F;&#x65F6;&#x67F1;&#x7684;&#x5F00;&#x59CB;&#xFF1A;</p>
<pre><code>//@version=4
study(&quot;new 30 min bar&quot;)
is_newbar(res) =&gt;
    t = time(res)
    not na(t) and (na(t[1]) or t &gt; t[1])
plot(is_newbar(&quot;30&quot;) ? 1 : 0)
</code></pre><p><img src="../img/310sn/Chart_time_2.png" alt="&#x793A;&#x4F8B;&#x56FE;"></p>
<p>&#x524D;&#x9762;&#x4F8B;&#x5B50;&#x4E2D;&#x7684; is_newbar &#x81EA;&#x5B9A;&#x4E49;&#x51FD;&#x6570;&#x53EF;&#x4EE5;&#x5728;&#x5F88;&#x591A;&#x60C5;&#x51B5;&#x4E0B;&#x4F7F;&#x7528;&#x3002;&#x5728;&#x8FD9;&#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x7528;&#x5B83;&#x6765;&#x663E;&#x793A;&#x5E02;&#x573A;&#x5728;&#x65E5;&#x5185;&#x56FE;&#x4E0A;&#x7684;&#x5F00;&#x76D8;&#x9AD8;&#x70B9;&#x548C;&#x4F4E;&#x70B9;&#xFF1A;</p>
<pre><code>//@version=4
study(&quot;Opening high/low&quot;, overlay=true)

highTimeFrame = input(&quot;D&quot;, type=input.resolution)
sessSpec = input(&quot;0930-1600&quot;, type=input.session)

is_newbar(res, sess) =&gt;
    t = time(res, sess)
    na(t[1]) and not na(t) or t[1] &lt; t

newbar = is_newbar(&quot;1440&quot;, sessSpec)

var float s1 = na
var float s2 = na
if newbar
    s1 := low
    s2 := high

plot(s1, style=plot.style_circles, linewidth=3, color=color.red)
plot(s2, style=plot.style_circles, linewidth=3, color=color.lime)
</code></pre><p><img src="../img/310sn/Chart_time_3.png" alt="&#x793A;&#x4F8B;&#x56FE;"></p>
<p>&#x8BF7;&#x6CE8;&#x610F;&#x53D8;&#x91CF; highTimeFrame &#x548C; sessSpec&#x3002;&#x5B83;&#x4EEC;&#x662F;&#x7528; input &#x51FD;&#x6570;&#x53CA;&#x5176; type &#x53C2;&#x6570;&#x5B9A;&#x4E49;&#x7684;&#xFF0C;&#x4EE5;&#x4F7F;&#x5176;&#x7C7B;&#x578B;&#x660E;&#x786E;&#x3002;</p>
<h2 id="&#x7528;&#x4E8E;&#x5904;&#x7406;&#x65F6;&#x95F4;&#x7684;&#x5185;&#x7F6E;&#x53D8;&#x91CF;">&#x7528;&#x4E8E;&#x5904;&#x7406;&#x65F6;&#x95F4;&#x7684;&#x5185;&#x7F6E;&#x53D8;&#x91CF;</h2>
<p>Pine &#x7684;&#x6807;&#x51C6;&#x5E93;&#x6709;&#x5404;&#x79CD;&#x5404;&#x6837;&#x7684;&#x5185;&#x7F6E;&#x53D8;&#x91CF;&#x548C;&#x51FD;&#x6570;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x811A;&#x672C;&#x7684;&#x903B;&#x8F91;&#x4E2D;&#x4F7F;&#x7528;&#x65F6;&#x95F4;&#x3002;</p>
<p>&#x6700;&#x57FA;&#x672C;&#x7684;&#x53D8;&#x91CF;&#xFF1A;</p>
<ul>
<li>time &#x2014; &#x5F53;&#x524D;&#x67F1;&#x7684; UNIX &#x65F6;&#x95F4;&#xFF08;&#x4EE5;&#x6BEB;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#xFF0C;UTC &#x65F6;&#x533A;&#x3002;</li>
<li>timenow &#x2014; &#x4EE5;&#x6BEB;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#x7684;&#x5F53;&#x524D; UNIX &#x65F6;&#x95F4;&#xFF0C;UTC &#x65F6;&#x533A;&#x3002;</li>
<li>syminfo.timezone &#x2014; &#x56FE;&#x8868;&#x4E3B;&#x8981;&#x4EA4;&#x6613;&#x54C1;&#x79CD;&#x7CFB;&#x5217;&#x7684;&#x4EA4;&#x6613;&#x6240;&#x65F6;&#x533A;&#x3002;</li>
</ul>
<p>&#x63D0;&#x4F9B;&#x6709;&#x5173;&#x5F53;&#x524D;&#x67F1;&#x5F00;&#x59CB;&#x65F6;&#x95F4;&#x4FE1;&#x606F;&#x7684;&#x53D8;&#x91CF;&#xFF1A;</p>
<ul>
<li>year &#x2014; &#x5F53;&#x524D;&#x6761;&#x5F62;&#x5E74;&#x4EFD;&#x3002;</li>
<li>month &#x2014; &#x5F53;&#x524D;&#x67F1;&#x72B6;&#x56FE;&#x6708;&#x4EFD;&#x3002;</li>
<li>weekofyear &#x2014; &#x5F53;&#x524D;&#x67F1;&#x7684;&#x5468;&#x6570;&#x3002;</li>
<li>dayofmonth &#x2014; &#x5F53;&#x524D;&#x67F1;&#x7684;&#x65E5;&#x671F;&#x3002;</li>
<li>dayofweek &#x2014; &#x5F53;&#x524D;&#x67F1;&#x7684;&#x661F;&#x671F;&#x51E0;&#x3002;&#x60A8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; sunday&#xFF0C;monday&#xFF0C;tuesday&#xFF0C;wednesday&#xFF0C;thursday&#xFF0C;friday &#x548C; saturday &#x7528;&#x4E8E;&#x6BD4;&#x8F83;&#x7684;&#x53D8;&#x91CF;&#x3002;</li>
<li>hour &#x2014; &#x5F53;&#x524D;&#x67F1;&#x5F00;&#x59CB;&#x65F6;&#x95F4;&#x7684;&#x5C0F;&#x65F6;&#xFF08;&#x5728;&#x4EA4;&#x6613;&#x6240;&#x65F6;&#x533A;&#xFF09;&#x3002;</li>
<li>minute &#x2014; &#x5F53;&#x524D;&#x67F1;&#x5F00;&#x59CB;&#x65F6;&#x95F4;&#x7684;&#x5206;&#x949F;&#xFF08;&#x5728;&#x4EA4;&#x6613;&#x6240;&#x65F6;&#x533A;&#xFF09;&#x3002;</li>
<li>second &#x2014; &#x5F53;&#x524D;&#x67F1;&#x5F00;&#x59CB;&#x65F6;&#x95F4;&#x7684;&#x79D2;&#xFF08;&#x5728;&#x4EA4;&#x6613;&#x6240;&#x65F6;&#x533A;&#xFF09;&#x3002;</li>
</ul>
<p>UNIX &#x65F6;&#x95F4;&#x201C;&#x6784;&#x9020;&#x201D;&#x7684;&#x51FD;&#x6570;&#xFF1A;</p>
<ul>
<li>year(t) &#x2014; &#x8FD4;&#x56DE;&#x63D0;&#x4F9B;&#x7684; UTC &#x65F6;&#x95F4;&#x7684;&#x5E74;&#x4EFD;t&#x3002;</li>
<li>month(t) &#x2014; &#x8FD4;&#x56DE;&#x63D0;&#x4F9B;&#x7684; UTC &#x65F6;&#x95F4;&#x7684;&#x6708;&#x4EFD;t&#x3002;</li>
<li>weekofyear(t) &#x2014; &#x4E3A;&#x63D0;&#x4F9B;&#x7684; UTC &#x65F6;&#x95F4;&#x8FD4;&#x56DE;&#x4E00;&#x5E74;&#x4E2D;&#x7684;&#x4E00;&#x5468;t&#x3002;</li>
<li>dayofmonth(t) &#x2014; &#x8FD4;&#x56DE;&#x63D0;&#x4F9B;&#x7684; UTC &#x65F6;&#x95F4;&#x7684;&#x6708;&#x4EFD;&#x4E2D;&#x7684;&#x67D0;&#x4E00;&#x5929;t&#x3002;</li>
<li>dayofweek(t) &#x2014; &#x8FD4;&#x56DE;&#x63D0;&#x4F9B;&#x7684; UTC &#x65F6;&#x95F4;&#x7684;&#x661F;&#x671F;&#x51E0;t&#x3002;</li>
<li>hour(t) &#x2014; &#x8FD4;&#x56DE;&#x63D0;&#x4F9B;&#x7684; UTC &#x65F6;&#x95F4;&#x7684;&#x5C0F;&#x65F6;t&#x3002;</li>
<li>minute(t) &#x2014; &#x8FD4;&#x56DE;&#x63D0;&#x4F9B;&#x7684; UTC &#x65F6;&#x95F4;&#x7684;&#x5206;&#x949F;t&#x3002;</li>
<li>second(t) &#x2014; &#x4E3A;&#x63D0;&#x4F9B;&#x7684; UTC &#x65F6;&#x95F4;&#x8FD4;&#x56DE;&#x79D2;t&#x3002;</li>
<li>timestamp(year, month, day, hour, minute) &#x2014; &#x8FD4;&#x56DE;&#x6307;&#x5B9A;&#x65E5;&#x671F;&#x548C;&#x65F6;&#x95F4;&#x7684; UNIX &#x65F6;&#x95F4;&#x3002;&#x8BF7;&#x6CE8;&#x610F;&#xFF0C;&#x8FD8;&#x6709;&#x4E00;&#x4E2A;&#x5E26;&#x6709;&#x9644;&#x52A0; timezone &#x53C2;&#x6570;&#x7684;&#x91CD;&#x8F7D;&#x7248;&#x672C;&#x3002;</li>
</ul>
<p>&#x6240;&#x6709;&#x8FD9;&#x4E9B;&#x53D8;&#x91CF;&#x548C;&#x51FD;&#x6570;&#x90FD;&#x8FD4;&#x56DE;&#x4EA4;&#x6362;&#x65F6;&#x533A;&#x7684;&#x65F6;&#x95F4;&#xFF0C;&#x53EA;&#x6709; time &#x548C; timenow &#x53D8;&#x91CF;&#x662F;&#x8FD4;&#x56DE; UTC &#x65F6;&#x533A;&#x7684;&#x65F6;&#x95F4;&#x3002;</p>
<blockquote>
<p>&#x811A;&#x6CE8;</p>
<p>[1]    UNIX &#x65F6;&#x95F4;&#x4EE5;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#x3002;Pine Script &#x4F7F;&#x7528; UNIX &#x65F6;&#x95F4;&#x4E58;&#x4EE5; 1000&#xFF0C;&#x6240;&#x4EE5;&#x5B83;&#x4EE5;&#x6BEB;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#x3002;</p>
</blockquote>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="9nonstandard.html" class="navigation navigation-prev " aria-label="Previous page: 非标准图表类型数据">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="11strategies.html" class="navigation navigation-next " aria-label="Next page: 策略">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"交易时段和时间信息","level":"1.5.10","depth":2,"next":{"title":"策略","level":"1.5.11","depth":2,"path":"features/11strategies.md","ref":"./features/11strategies.md","articles":[]},"previous":{"title":"非标准图表类型数据","level":"1.5.9","depth":2,"path":"features/9nonstandard.md","ref":"./features/9nonstandard.md","articles":[]},"dir":"ltr"},"config":{"plugins":["livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"剑客","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Pine Script 用户手册中文版","language":"zh","gitbook":"*","description":"Pine Script 文档中文翻译"},"file":{"path":"features/10session.md","mtime":"2021-06-12T11:59:33.407Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-06-14T07:42:18.199Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

